// 流程审批路由配置
const workflowRoutes = {
  path: '/workflow',
  component: () => import('@/layout'),
  redirect: '/workflow/approval/todo',
  name: 'Workflow',
  meta: {
    title: '流程审批',
    icon: 'form',
    roles: ['admin', 'hr', 'finance', 'manager', 'employee']
  },
  children: [
    // 审批中心
    {
      path: 'approval',
      name: 'Approval',
      component: { render: (e) => e("router-view") },
      redirect: '/workflow/approval/todo',
      meta: {
        title: '审批中心',
        icon: 'approval'
      },
      children: [
        {
          path: 'todo',
          name: 'TodoTasks',
          component: () => import('@/views/workflow/approval/index'),
          meta: {
            title: '待办任务',
            icon: 'todo'
          }
        },
        {
          path: 'done',
          name: 'DoneTasks',
          component: () => import('@/views/workflow/approval/history'),
          meta: {
            title: '已办任务',
            icon: 'done'
          }
        },
        {
          path: 'task/:taskId',
          name: 'TaskDetail',
          component: () => import('@/views/workflow/approval/task'),
          meta: {
            title: '任务详情',
            activeMenu: '/workflow/approval/todo',
            hidden: true
          }
        }
      ]
    },
    // 请假管理
    {
      path: 'leave',
      name: 'Leave',
      component: { render: (e) => e("router-view") },
      redirect: '/workflow/leave/index',
      meta: {
        title: '请假管理',
        icon: 'leave'
      },
      children: [
        {
          path: 'index',
          name: 'LeaveList',
          component: () => import('@/views/workflow/leave/index'),
          meta: {
            title: '请假列表',
            icon: 'list'
          }
        },
        {
          path: 'create',
          name: 'CreateLeave',
          component: () => import('@/views/workflow/leave/create'),
          meta: {
            title: '申请请假',
            icon: 'create'
          }
        },
        {
          path: 'detail/:id',
          name: 'LeaveDetail',
          component: () => import('@/views/workflow/leave/detail'),
          meta: {
            title: '请假详情',
            activeMenu: '/workflow/leave/index',
            hidden: true
          }
        }
      ]
    },
    // 报销管理
    {
      path: 'expense',
      name: 'Expense',
      component: { render: (e) => e("router-view") },
      redirect: '/workflow/expense/index',
      meta: {
        title: '报销管理',
        icon: 'expense'
      },
      children: [
        {
          path: 'index',
          name: 'ExpenseList',
          component: () => import('@/views/workflow/expense/index'),
          meta: {
            title: '报销列表',
            icon: 'list'
          }
        },
        {
          path: 'create',
          name: 'CreateExpense',
          component: () => import('@/views/workflow/expense/create'),
          meta: {
            title: '申请报销',
            icon: 'create'
          }
        },
        {
          path: 'detail/:id',
          name: 'ExpenseDetail',
          component: () => import('@/views/workflow/expense/detail'),
          meta: {
            title: '报销详情',
            activeMenu: '/workflow/expense/index',
            hidden: true
          }
        }
      ]
    },
    // 公文管理
    {
      path: 'document',
      name: 'WorkflowDocument',
      component: { render: (e) => e("router-view") },
      redirect: '/workflow/document/index',
      meta: {
        title: '公文管理',
        icon: 'document'
      },
      children: [
        {
          path: 'index',
          name: 'DocumentList',
          component: () => import('@/views/workflow/document/index'),
          meta: {
            title: '公文列表',
            icon: 'list'
          }
        },
        {
          path: 'create',
          name: 'CreateDocument',
          component: () => import('@/views/workflow/document/create'),
          meta: {
            title: '起草公文',
            icon: 'create'
          }
        },
        {
          path: 'detail/:id',
          name: 'DocumentDetail',
          component: () => import('@/views/workflow/document/detail'),
          meta: {
            title: '公文详情',
            activeMenu: '/workflow/document/index',
            hidden: true
          }
        }
      ]
    }
  ]
}

export default workflowRoutes 